﻿using System;

namespace Raider.WinForms.Actions
{
    /// <summary>
    /// Provides event arguments for <see cref="IAction.Execute"/> event handlers.
    /// </summary>
    public class ExecuteEventArgs : EventArgs
    {
        /// <summary/>
        public ExecuteEventArgs(object argument = null)
        {
            Argument = argument;
        }

        /// <summary>
        /// Gets the event argument (optional).
        /// </summary>
        public object Argument
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets or sets a result of the event, that will be passed to
        /// <see cref="IAction.Executed"/> event (optional).
        /// </summary>
        public object Result
        {
            get;
            set;
        }

        /// <summary/>
        internal ExecutedEventArgs GetExecutedArgs()
        {
            return Result == null 
                ? ExecutedEventArgs.Empty 
                : new ExecutedEventArgs(Result);
        }
    }
}
